home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue37 / outlook / mapi / mapix.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1997-06-19  |  14.6 KB  |  382 lines

  1. {++
  2.  
  3.   m a p i x . p a s
  4.  
  5.   Abstract:
  6.  
  7.     Automatic conversion of mapix.h.
  8.  
  9.   Comments:
  10.  
  11.     This source file automatically converted by
  12.     htrans 0.91 beta 1 Copyright (c) 1997 Alexander Staubo
  13.  
  14.   Revision history:
  15.  
  16.     18-06-1997 20:53 alex  [Autogenerated]
  17.     18-06-1997 20:53 alex  Retouched for release
  18.  
  19. --}
  20.  
  21. unit MapiX;
  22.  
  23. interface
  24.  
  25. uses
  26.   Windows, SysUtils, ActiveX,
  27.   MapiGuid, MapiDefs;
  28.  
  29. (*
  30.  *  M A P I X . H
  31.  *  
  32.  *  Definitions of objects/flags, etc used by Extended MAPI.
  33.  *  
  34.  *  Copyright 1986-1996 Microsoft Corporation. All Rights Reserved.
  35.  *)
  36.  
  37. { ------------------------------------------------------ }
  38.  
  39. { shared with simple mapi }
  40.  
  41. type
  42.   TFLAGS = ULONG;
  43.   
  44. { MAPILogon() flags.       }
  45.  
  46. const
  47.   MAPI_LOGON_UI = $00000001            { Display logon UI                 }
  48.   ;
  49.   MAPI_NEW_SESSION = $00000002         { Don't use shared session         }
  50.   ;
  51.   MAPI_ALLOW_OTHERS = $00000008        { Make this a shared session       }
  52.   ;
  53.   MAPI_EXPLICIT_PROFILE = $00000010    { Don't use default profile        }
  54.   ;
  55.   MAPI_EXTENDED = $00000020            { Extended MAPI Logon              }
  56.   ;
  57.   MAPI_FORCE_DOWNLOAD = $00001000      { Get new mail before return       }
  58.   ;
  59.   MAPI_SERVICE_UI_ALWAYS = $00002000   { Do logon UI in all providers     }
  60.   ;
  61.   MAPI_NO_MAIL = $00008000             { Do not activate transports       }
  62.   ;
  63.  
  64. { #define MAPI_NT_SERVICE          0x00010000  Allow logon from an NT service  }
  65.  
  66. const
  67.   MAPI_PASSWORD_UI = $00020000         { Display password UI only         }
  68.   ;
  69.  
  70.   MAPI_TIMEOUT_SHORT = $00100000       { Minimal wait for logon resources }
  71.   ;
  72.   MAPI_SIMPLE_DEFAULT = MAPI_LOGON_UI or MAPI_FORCE_DOWNLOAD or MAPI_ALLOW_OTHERS;
  73.   MAPI_SIMPLE_EXPLICIT = MAPI_NEW_SESSION or MAPI_FORCE_DOWNLOAD or MAPI_EXPLICIT_PROFILE;
  74.  
  75. { Structure passed to MAPIInitialize(), and its ulFlags values }
  76.  
  77. type
  78.   TMAPIINIT_0 =     
  79.     record
  80.       ulVersion : ULONG;
  81.       ulFlags : ULONG;
  82.     end;
  83.   
  84.   PMAPIINIT_0 = ^TMAPIINIT_0;
  85.   
  86.   TMAPIINIT = TMAPIINIT_0;
  87.   
  88.   PMAPIINIT = ^TMAPIINIT;
  89.   
  90. const
  91.   MAPI_INIT_VERSION = 0;
  92.   MAPI_MULTITHREAD_NOTIFICATIONS = $00000001;
  93.  
  94. { Reserved for MAPI                    0x40000000 }
  95.  
  96. { #define MAPI_NT_SERVICE              0x00010000  Use from NT service }
  97.  
  98. { IMAPISession Interface -------------------------------------------------- }
  99.  
  100. { Flags for OpenEntry and others }
  101.  
  102. {#define MAPI_MODIFY               ((ULONG) 0x00000001) }
  103.  
  104. { Flags for Logoff }
  105.  
  106. const
  107.   MAPI_LOGOFF_SHARED = $00000001       { Close all shared sessions    }
  108.   ;
  109.   MAPI_LOGOFF_UI = $00000002           { It's OK to present UI        }
  110.   ;
  111.  
  112. { Flags for SetDefaultStore. They are mutually exclusive. }
  113.  
  114. const
  115.   MAPI_DEFAULT_STORE = $00000001       { for incoming messages }
  116.   ;
  117.   MAPI_SIMPLE_STORE_TEMPORARY = $00000002
  118.                                        { for simple MAPI and CMC }
  119.   ;
  120.   MAPI_SIMPLE_STORE_PERMANENT = $00000003
  121.                                        { for simple MAPI and CMC }
  122.   ;
  123.   MAPI_PRIMARY_STORE = $00000004       { Used by some clients }
  124.   ;
  125.   MAPI_SECONDARY_STORE = $00000005     { Used by some clients }
  126.   ;
  127.  
  128. { Flags for ShowForm. }
  129.  
  130. const
  131.   MAPI_POST_MESSAGE = $00000001        { Selects post/send semantics }
  132.   ;
  133.   MAPI_NEW_MESSAGE = $00000002         { Governs copying during submission }
  134.   ;
  135.  
  136. {  MessageOptions }
  137.  
  138. {***** MAPI_UNICODE            ((ULONG) 0x80000000) }
  139.  
  140. {  QueryDefaultMessageOpt }
  141.  
  142. {***** MAPI_UNICODE            ((ULONG) 0x80000000) }
  143.  
  144. { IAddrBook Interface ----------------------------------------------------- }
  145.  
  146. {  CreateOneOff }
  147.  
  148. {***** MAPI_UNICODE            ((ULONG) 0x80000000) }
  149.  
  150. {***** MAPI_SEND_NO_RICH_INFO      ((ULONG) 0x00010000) }
  151.  
  152. {  RecipOptions }
  153.  
  154. {***** MAPI_UNICODE            ((ULONG) 0x80000000) }
  155.  
  156. {  QueryDefaultRecipOpt }
  157.  
  158. {***** MAPI_UNICODE            ((ULONG) 0x80000000) }
  159.  
  160. {  GetSearchPath }
  161.  
  162. {***** MAPI_UNICODE            ((ULONG) 0x80000000) }
  163.  
  164. { IMsgServiceAdmin Interface ---------------------------------------------- }
  165.  
  166. { Values for PR_RESOURCE_FLAGS in message service table }
  167.  
  168. const
  169.   SERVICE_DEFAULT_STORE = $00000001;
  170.   SERVICE_SINGLE_COPY = $00000002;
  171.   SERVICE_CREATE_WITH_STORE = $00000004;
  172.   SERVICE_PRIMARY_IDENTITY = $00000008;
  173.   SERVICE_NO_PRIMARY_IDENTITY = $00000020;
  174.  
  175. {  GetMsgServiceTable }
  176.  
  177. {***** MAPI_UNICODE            ((ULONG) 0x80000000) }
  178.  
  179. {  GetProviderTable }
  180.  
  181. {***** MAPI_UNICODE            ((ULONG) 0x80000000) }
  182.  
  183. { IProfAdmin Interface ---------------------------------------------------- }
  184.  
  185. { Flags for CreateProfile }
  186.  
  187. const
  188.   MAPI_DEFAULT_SERVICES = $00000001;
  189.  
  190. { GetProfileTable }
  191.  
  192. {***** MAPI_UNICODE            ((ULONG) 0x80000000) }
  193.  
  194. {!! Interface declarations }
  195.  
  196. type
  197.   IAddrBook = interface;
  198.   IMsgServiceAdmin = interface;
  199.  
  200.   IMAPISession =
  201.     interface(IUnknown)
  202.     [strIID_IMAPISession]
  203.       function GetLastError (hResult : HResult; ulFlags : ULONG;
  204.         var lppMAPIError : PMAPIERROR) : HResult; stdcall;
  205.       function GetMsgStoresTable (ulFlags : ULONG;
  206.         out lppTable : IMAPITable) : HResult; stdcall;
  207.       function OpenMsgStore (ulUIParam : ULONG; cbEntryID : ULONG;
  208.         lpEntryID : PENTRYID; const lpInterface : TIID; ulFlags : ULONG;
  209.         out lppMDB : IMsgStore) : HResult; stdcall;
  210.       function OpenAddressBook (ulUIParam : ULONG; const lpInterface : TIID;
  211.         ulFlags : ULONG; out lppAdrBook : IAddrBook) : HResult; stdcall;
  212.       function OpenProfileSection (lpUID : PMAPIUID; const lpInterface : TIID;
  213.         ulFlags : ULONG; out lppProfSect : IProfSect) : HResult; stdcall;
  214.       function GetStatusTable (ulFlags : ULONG;
  215.         out lppTable : IMAPITable) : HResult; stdcall;
  216.       function OpenEntry (cbEntryID : ULONG; lpEntryID : PENTRYID;
  217.         const lpInterface : TIID; ulFlags : ULONG; var lpulObjType : ULONG;
  218.         out lppUnk : IUnknown) : HResult; stdcall;
  219.       function CompareEntryIDs (cbEntryID1 : ULONG; lpEntryID1 : PENTRYID;
  220.         cbEntryID2 : ULONG; lpEntryID2 : PENTRYID; ulFlags : ULONG;
  221.         var lpulResult : ULONG) : HResult; stdcall;
  222.       function Advise (cbEntryID : ULONG; lpEntryID : PENTRYID;
  223.         ulEventMask : ULONG; lpAdviseSink : IMAPIAdviseSink;
  224.         var lpulConnection : ULONG) : HResult; stdcall;
  225.       function Unadvise (ulConnection : ULONG) : HResult; stdcall;
  226.       function MessageOptions (ulUIParam : ULONG; ulFlags : ULONG;
  227.         lpszAdrType : PChar; lpMessage : IMessage) : HResult; stdcall;
  228.       function QueryDefaultMessageOpt (lpszAdrType : PChar; ulFlags : ULONG;
  229.         var lpcValues : ULONG; var lppOptions : PSPropValue) : HResult; stdcall;
  230.       function EnumAdrTypes (ulFlags : ULONG; var lpcAdrTypes : ULONG;
  231.         var lpppszAdrTypes : PChar) : HResult; stdcall;
  232.       function QueryIdentity (var lpcbEntryID : ULONG;
  233.         var lppEntryID : PENTRYID) : HResult; stdcall;
  234.       function Logoff (ulUIParam : ULONG; ulFlags : ULONG;
  235.         ulReserved : ULONG) : HResult; stdcall;
  236.       function SetDefaultStore (ulFlags : ULONG; cbEntryID : ULONG;
  237.         lpEntryID : PENTRYID) : HResult; stdcall;
  238.       function AdminServices (ulFlags : ULONG;
  239.         out lppServiceAdmin : IMsgServiceAdmin) : HResult; stdcall;
  240.       function ShowForm (ulUIParam : ULONG; lpMsgStore : IMsgStore;
  241.         lpParentFolder : IMAPIFolder; const lpInterface : TIID;
  242.         ulMessageToken : ULONG; lpMessageSent : IMessage; ulFlags : ULONG;
  243.         ulMessageStatus : ULONG; ulMessageFlags : ULONG; ulAccess : ULONG;
  244.         lpszMessageClass : LPSTR) : HResult; stdcall;
  245.       function PrepareForm (const lpInterface : TIID; lpMessage : IMessage;
  246.         var lpulMessageToken : ULONG) : HResult; stdcall;
  247.     end;
  248.  
  249.   IAddrBook =
  250.     interface(IMAPIProp)
  251.     [strIID_IAddrBook]  
  252.       function OpenEntry (cbEntryID : ULONG; lpEntryID : PENTRYID; const lpInterface : TIID;
  253.         ulFlags : ULONG; var lpulObjType : ULONG; out lppUnk : IUnknown) : HResult; stdcall;
  254.       function CompareEntryIDs (cbEntryID1 : ULONG; lpEntryID1 : PENTRYID; 
  255.         cbEntryID2 : ULONG; lpEntryID2 : PENTRYID; ulFlags : ULONG; 
  256.         var lpulResult : ULONG) : HResult; stdcall;
  257.       function Advise (cbEntryID : ULONG; lpEntryID : PENTRYID; ulEventMask : ULONG; 
  258.         lpAdviseSink : IMAPIAdviseSink; var lpulConnection : ULONG) : HResult; stdcall;
  259.       function Unadvise (ulConnection : ULONG) : HResult; stdcall;
  260.       function CreateOneOff (lpszName : PChar; lpszAdrType : PChar;
  261.         lpszAddress : PChar; ulFlags : ULONG; var lpcbEntryID : ULONG;
  262.         var lppEntryID : PENTRYID) : HResult; stdcall;
  263.       function NewEntry (ulUIParam : ULONG; ulFlags : ULONG; cbEIDContainer : ULONG; 
  264.         lpEIDContainer : PENTRYID; cbEIDNewEntryTpl : ULONG; 
  265.         lpEIDNewEntryTpl : PENTRYID; var lpcbEIDNewEntry : ULONG; 
  266.         var lppEIDNewEntry : PENTRYID) : HResult; stdcall;
  267.       function ResolveName (ulUIParam : ULONG; ulFlags : ULONG;
  268.         lpszNewEntryTitle : PChar; lpAdrList : PADRLIST) : HResult; stdcall;
  269.       function Address (var lpulUIParam : ULONG; lpAdrParms : PADRPARM; 
  270.         var lppAdrList : PADRLIST) : HResult; stdcall;
  271.       function Details (var lpulUIParam : ULONG; lpfnDismiss : PFNDISMISS; 
  272.         lpvDismissContext : Pointer; cbEntryID : ULONG; lpEntryID : PENTRYID; 
  273.         lpfButtonCallback : PFNBUTTON; lpvButtonContext : Pointer; 
  274.         lpszButtonText : PChar; ulFlags : ULONG) : HResult; stdcall;
  275.       function RecipOptions (ulUIParam : ULONG; ulFlags : ULONG;
  276.         lpRecip : PADRENTRY) : HResult; stdcall;
  277.       function QueryDefaultRecipOpt (lpszAdrType : PChar; ulFlags : ULONG;
  278.         var lpcValues : ULONG; var lppOptions : PSPropValue) : HResult; stdcall;
  279.       function GetPAB (var lpcbEntryID : ULONG;
  280.         var lppEntryID : PENTRYID) : HResult; stdcall;
  281.       function SetPAB (cbEntryID : ULONG;
  282.         lpEntryID : PENTRYID) : HResult; stdcall;
  283.       function GetDefaultDir (var lpcbEntryID : ULONG;
  284.         var lppEntryID : PENTRYID) : HResult; stdcall;
  285.       function SetDefaultDir (cbEntryID : ULONG;
  286.         lpEntryID : PENTRYID) : HResult; stdcall;
  287.       function GetSearchPath (ulFlags : ULONG;
  288.         var lppSearchPath : PSRowSet) : HResult; stdcall;
  289.       function SetSearchPath (ulFlags : ULONG;
  290.         lpSearchPath : PSRowSet) : HResult; stdcall;
  291.       function PrepareRecips (ulFlags : ULONG; lpPropTagArray : PSPropTagArray;
  292.         lpRecipList : PADRLIST) : HResult; stdcall;
  293.     end;
  294.  
  295.   IProfAdmin =
  296.     interface(IUnknown)
  297.     [strIID_IProfAdmin]
  298.       function GetLastError (hResult : HResult; ulFlags : ULONG;
  299.         var lppMAPIError : PMAPIERROR) : HResult; stdcall;
  300.       function GetProfileTable (ulFlags : ULONG; out lppTable : IMAPITable) : HResult; stdcall;
  301.       function CreateProfile (lpszProfileName : PChar; lpszPassword : PChar; 
  302.         ulUIParam : ULONG; ulFlags : ULONG) : HResult; stdcall;
  303.       function DeleteProfile (lpszProfileName : PChar; ulFlags : ULONG) : HResult; stdcall;
  304.       function ChangeProfilePassword (lpszProfileName : PChar; 
  305.         lpszOldPassword : PChar; lpszNewPassword : PChar; ulFlags : ULONG) : HResult; stdcall;
  306.       function CopyProfile (lpszOldProfileName : PChar; lpszOldPassword : PChar; 
  307.         lpszNewProfileName : PChar; ulUIParam : ULONG; ulFlags : ULONG) : HResult; stdcall;
  308.       function RenameProfile (lpszOldProfileName : PChar; lpszOldPassword : PChar; 
  309.         lpszNewProfileName : PChar; ulUIParam : ULONG; ulFlags : ULONG) : HResult; stdcall;
  310.       function SetDefaultProfile (lpszProfileName : PChar; ulFlags : ULONG) : HResult; stdcall;
  311.       function AdminServices (lpszProfileName : PChar; lpszPassword : PChar; 
  312.         ulUIParam : ULONG; ulFlags : ULONG; out lppServiceAdmin : IMsgServiceAdmin) : HResult; stdcall;
  313.     end;
  314.  
  315.   IMsgServiceAdmin =
  316.     interface(IUnknown)
  317.     [strIID_IMsgServiceAdmin]
  318.       function GetLastError (hResult : HResult; ulFlags : ULONG;
  319.         var lppMAPIError : PMAPIERROR) : HResult; stdcall;
  320.       function GetMsgServiceTable (ulFlags : ULONG; out lppTable : IMAPITable) : HResult; stdcall;
  321.       function CreateMsgService (lpszService : PChar; lpszDisplayName : PChar; 
  322.         ulUIParam : ULONG; ulFlags : ULONG) : HResult; stdcall;
  323.       function DeleteMsgService (lpUID : PMAPIUID) : HResult; stdcall;
  324.       function CopyMsgService (lpUID : PMAPIUID; lpszDisplayName : PChar; 
  325.         const lpInterfaceToCopy : TIID; const lpInterfaceDst : TIID;
  326.         lpObjectDst : Pointer; ulUIParam : ULONG;
  327.         ulFlags : ULONG) : HResult; stdcall;
  328.       function RenameMsgService (lpUID : PMAPIUID; ulFlags : ULONG; 
  329.         lpszDisplayName : PChar) : HResult; stdcall;
  330.       function ConfigureMsgService (lpUID : PMAPIUID; ulUIParam : ULONG; 
  331.         ulFlags : ULONG; cValues : ULONG; lpProps : PSPropValue) : HResult; stdcall;
  332.       function OpenProfileSection (lpUID : PMAPIUID; const lpInterface : TIID;
  333.         ulFlags : ULONG; out lppProfSect : IProfSect) : HResult; stdcall;
  334.       function MsgServiceTransportOrder (cUID : ULONG; lpUIDList : PMAPIUID; 
  335.         ulFlags : ULONG) : HResult; stdcall;
  336.       function AdminProviders (lpUID : PMAPIUID; ulFlags : ULONG;
  337.         out lppProviderAdmin : IProviderAdmin) : HResult; stdcall;
  338.       function SetPrimaryIdentity (lpUID : PMAPIUID; ulFlags : ULONG) : HResult; stdcall;
  339.       function GetProviderTable (ulFlags : ULONG; out lppTable : IMAPITable) : HResult; stdcall;
  340.     end;
  341.  
  342. {!! These functions have been converted from being dynamically bound variables
  343.   to statically bound externals }
  344.  
  345. { MAPI base functions }
  346.  
  347. function MAPIInitialize (lpMapiInit : Pointer) : HResult; stdcall;
  348. procedure MAPIUninitialize; stdcall;
  349.  
  350. {  Extended MAPI Logon function }
  351.  
  352. function MAPILogonEx (ulUIParam : ULONG; lpszProfileName : PChar;
  353.   lpszPassword : PChar; ulFlags : ULONG; {  ulFlags takes all that SimpleMAPI does + MAPI_UNICODE }
  354.   out lppSession : IMAPISession) : HResult; stdcall;
  355.  
  356. function MAPIAllocateBuffer (cbSize : ULONG;
  357.   var lppBuffer : Pointer) : SCODE; stdcall;
  358.  
  359. function MAPIAllocateMore (cbSize : ULONG; lpObject : Pointer;
  360.   var lppBuffer : Pointer) : SCODE; stdcall;
  361.  
  362. function MAPIFreeBuffer (lpBuffer : Pointer) : ULONG; stdcall;
  363.  
  364. function MAPIAdminProfiles (ulFlags : ULONG;
  365.   out lppProfAdmin : IProfAdmin) : HResult; stdcall;
  366.  
  367. implementation
  368.  
  369. const
  370.   Mapi32Dll = 'mapi32.dll';
  371.  
  372. function MAPIInitialize; external Mapi32Dll;
  373. procedure MAPIUninitialize; external Mapi32Dll;
  374. function MAPILogonEx; external Mapi32Dll;
  375. function MAPIAllocateBuffer; external Mapi32Dll;
  376. function MAPIAllocateMore; external Mapi32Dll;
  377. function MAPIFreeBuffer; external Mapi32Dll;
  378. function MAPIAdminProfiles; external Mapi32Dll;
  379.  
  380. end.
  381.  
  382.